const express = require('express')

const router = express.Router()

// 验证数据合法性的中间件
const expressJoi = require('@escook/express-joi')

const userinfo_handler = require('../router_handler/userinfo')

const {
    update_userinfo_schema,
    update_password_schema,
    update_avatar_schema
} = require('../schema/user')

// 挂载路由

router.get('/userinfo', userinfo_handler.getUserIfo)
router.get('/userallinfo', userinfo_handler.getAllUserIfo)

router.post('/updateuserinfo',userinfo_handler.updateUserInfo)

router.post('/deleteUserInfo',userinfo_handler.deleteUserInfo)
router.post('/updatepwd', expressJoi(update_password_schema), userinfo_handler.updatepwd)

router.post('/avatar', expressJoi(update_avatar_schema),userinfo_handler.updateAvatar)


module.exports = router